package com.nhim.cms.admin.server.locator;

import com.google.web.bindery.requestfactory.shared.Locator;
import com.nhim.cms.dao.CustomWidgetPropertyValueDAO;
import com.nhim.cms.domain.CustomWidgetPropertyValue;
import com.nhim.core.AppContext;

public class CustomWidgetPropertyValueLocator extends Locator<CustomWidgetPropertyValue, Integer>{

	CustomWidgetPropertyValueDAO customWidgetPropertyValueDAO = CustomWidgetPropertyValueDAO.getFromApplicationContext(AppContext.getApplicationContext());
	
	@Override
	public CustomWidgetPropertyValue create(
			Class<? extends CustomWidgetPropertyValue> clazz) {
		return new CustomWidgetPropertyValue();
	}

	@Override
	public CustomWidgetPropertyValue find(
			Class<? extends CustomWidgetPropertyValue> clazz, Integer id) {
		if (id == null)
			return new CustomWidgetPropertyValue();
		return customWidgetPropertyValueDAO.findById(id);
	}

	@Override
	public Class<CustomWidgetPropertyValue> getDomainType() {
		return CustomWidgetPropertyValue.class;
	}

	@Override
	public Integer getId(CustomWidgetPropertyValue domainObject) {
		return domainObject.getId();
	}

	@Override
	public Class<Integer> getIdType() {
		return Integer.class;
	}

	@Override
	public Object getVersion(CustomWidgetPropertyValue domainObject) {
		return domainObject.getVersion();
	}

}
